﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ZhiPiaoXJFW.aspx.cs" Inherits="Web.Pages.QuShui.DiXiaS._5.ShouFeiGL.ZhiPiaoXJFW" Theme="Default" %>
<%--已废弃 comment by guodengjie at 2017/6/12--%>
<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../../css/inputBgColor.css" rel="stylesheet" />
    <script src="../../../../JS/AddEditCancel.js"></script>
    <script type="text/javascript">
        //打开托收情况汇总
        //function openGeneranize() {
        //    openCenter("/Pages/YongShui/5.ShouFeiGL/ZhiPiaoXJFW_CK.aspx?ym=" + encodeURI(tab2txtZWYM.GetText()), "800px", "750px");
        //}
        
        //用户号回车事件
        function tab1txtYONGHUHKeyPress() {
            if (event.keyCode == 13) {
                if (tab1txtYONGHUH.GetText() == '') {
                    alert('请输入用户号。');
                    return;
                }
                ASPxCallbackCommon.PerformCallback("yonghuh");
            }
        }
        //水量年月回车事件
        function tab1txtYMKeyPress() {
            if (event.keyCode == 13) {
                if (tab1txtYONGHUH.GetText() == '') {
                    alert('请输入用户号。');
                    tab1txtYONGHUH.Focus();
                    return;
                }
                if (tab1txtYM.GetText() == '') {
                    alert('请输入年月。')
                    tab1txtYM.Focus();
                    return;
                }
                ASPxCallbackCommon.PerformCallback("ym");
            }
        }
        //收费金额回车事件
        function tab1txtSHOUFEIJINEKeyPress() {
            if (tab1txtYONGHUH.GetText() == '') {
                alert('请输入用户号。');
                tab1txtYONGHUH.Focus();
                return;
            }
            if (tab1txtYM.GetText() == '') {
                alert('请输入年月。')
                tab1txtYM.Focus();
                return;
            }
            if (tab1txtSHOUFEIJINE.GetText() == "") {
                alert("请输入收费金额。");
                return false;
            }
            ASPxCallbackCommon.PerformCallback("sf");
        }
        function tab1AddPL()
        {
            ASPxCallbackCommon.PerformCallback("plsf");
        }
        //确认收费
        function btnQUERENSFClick() {
            if (this.tab1cmbSHOUFEILX.GetText() == "") {
                alert("请选择收费类型。");
                return false;
            }
            ASPxCallbackCommon.PerformCallback("qrsf");
        }
        //取消收费
        function btnSHOUFEICZClick() {
            if (confirm("确定要取消该笔收费吗?")) {
                ASPxCallbackCommon.PerformCallback('qxsf');
            }
            return false;
        }

        function ASPxCallbackCommonComplete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            var specialIdentity = arr[2];
            var msg = arr[3].split('-');
            if (msg[0] == 'True') {
                if (specialIdentity != 'confirm') {
                    alert(msg[1]);
                }
            }
            hdCollection.Set("type", type);
            if (state == 'True') {
                if (type == "yonghuh") {
                    tab1txtYONGHUM.SetText(arr[4]);
                    btnActPerform.onClick();
                }
                else if (type == "ym") {
                    tab1txtYINGSHOUJE.SetText(arr[4]);
                    tab1txtSHISHOUJINE.SetText(arr[5]);
                    tab1txtSHOUFEIJINE.Focus();
                }
                else if (type == "sf") {
                    var onserver = false;
                    if (specialIdentity == "confirm") {
                        onserver = confirm(msg[1]);
                    }
                    else {
                        onserver = true;
                    }
                    if (onserver) {
                        btnActPerform.onClick();
                    }
                }
                else if (type == "plsf") {
                    btnActPerform.onClick();
                }
                else if (type == "qrsf") {
                    btnActPerform.onClick();
                }
                else if (type == "qxsf") {
                    btnActPerform.onClick();
                }
            }
            else {
                if (type == "yonghuh") {
                    tab1txtYONGHUM.SetText("");
                    tab1txtYINGSHOUJE.SetText("");
                    tab1txtSHISHOUJINE.SetText("");
                }
                else if (type == "ym") {
                    tab1txtYINGSHOUJE.SetText("");
                    tab1txtSHISHOUJINE.SetText("");
                    tab1txtYM.Focus();
                }
                else if (type == "sf") {

                }
                else if (type == "qrsf") {

                }
                else if (type == "qxsf") {

                }
            }
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div class="tabletitle1" align="center">
            支票现金付委
        </div>
        <asp:UpdatePanel ID="updatePanel1" runat="server">
            <ContentTemplate>
                <dx:ASPxHiddenField ID="hdCollection" runat="server"></dx:ASPxHiddenField>
                <div style="display: none;">
                    <dx:ASPxButton ID="btnActPerform" ClientInstanceName="btnActPerform" runat="server" Text="ASPxButton" OnClick="btnActPerform_Click" UseSubmitBehavior="false"></dx:ASPxButton>
                </div>
                <dx:ASPxCallback ID="ASPxCallbackCommon" ClientInstanceName="ASPxCallbackCommon" runat="server" OnCallback="ASPxCallbackCommon_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallbackCommonComplete(e.result);}"></dx:ASPxCallback>
                <dx:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0" Width="100%" Height="485px">
                    <TabPages>
                        <dx:TabPage Text="收费" Visible="true">
                            <ContentCollection>
                                <dx:ContentControl>
                                    <div style="width: 100%;">
                                        <div>
                                            <table>
                                                <tr>
                                                    <td style="text-align: right;">用户号：
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="tab1txtYONGHUH" ClientInstanceName="tab1txtYONGHUH" runat="server" Width="100%">
                                                            <ClientSideEvents KeyPress="function(s,e){tab1txtYONGHUHKeyPress();}" />
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;用户名称：
                                                    </td>
                                                    <td colspan="3">
                                                        <dx:ASPxTextBox ID="tab1txtYONGHUM" ClientInstanceName="tab1txtYONGHUM" runat="server" Width="100%" ReadOnly="true" ForeColor="#c0c0c0"></dx:ASPxTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>&nbsp;&nbsp;水量年月：
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="tab1txtYM" ClientInstanceName="tab1txtYM" runat="server" Width="100%">
                                                            <ClientSideEvents KeyUp="function(s,e){inputNum(s);tab1txtYMKeyPress();}" />
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;应收金额：
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="tab1txtYINGSHOUJE" ClientInstanceName="tab1txtYINGSHOUJE" runat="server" Width="100%" HorizontalAlign="Right" ReadOnly="true" ForeColor="#c0c0c0"></dx:ASPxTextBox>
                                                    </td>
                                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;已收金额：</td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="tab1txtSHISHOUJINE" ClientInstanceName="tab1txtSHISHOUJINE" runat="server" Width="100%" HorizontalAlign="Right" ReadOnly="true" ForeColor="#c0c0c0"></dx:ASPxTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>&nbsp;&nbsp;收费金额：
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="tab1txtSHOUFEIJINE" ClientInstanceName="tab1txtSHOUFEIJINE" runat="server" Width="100%" HorizontalAlign="Right">
                                                            <ClientSideEvents KeyPress="function(s,e){ if (event.keyCode == 13) {tab1txtSHOUFEIJINEKeyPress();}}" />
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <dx:ASPxLoadingPanel ID="LoadPanel" ClientInstanceName="LoadPanel" runat="server" Text="正在查询..."></dx:ASPxLoadingPanel>
                                                        <dx:ASPxButton ID="tab1btnAdd" ClientInstanceName="tab1btnAdd" runat="server" Text="添加" UseSubmitBehavior="false" AutoPostBack="false">
                                                            <ClientSideEvents Click="function(s,e){tab1txtSHOUFEIJINEKeyPress();} " />
                                                        </dx:ASPxButton>
                                                        <dx:ASPxLoadingPanel ID="ASPxLoadingPanel1" ClientInstanceName="ASPxLoadingPanel1" runat="server" Text="正在操作"></dx:ASPxLoadingPanel>
                                                    </td>
                                                    <td colspan="5">
                                                        <dx:ASPxButton ID="tab1btnAddPL" ClientInstanceName="tab1btnAddPL" runat="server" Text="批量添加" UseSubmitBehavior="false" AutoPostBack="false">
                                                            <ClientSideEvents Click="function(s,e){tab1AddPL();} " />
                                                        </dx:ASPxButton>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div>
                                            <div style="width: 60%; float: left;">
                                                <fieldset style="border: 1px solid  cornflowerblue">
                                                    <legend style="font-weight: bold">本次收费记录</legend>
                                                    <dx:ASPxGridView ID="gvBenCiSF" ClientInstanceName="gvBenCiSF" runat="server" AutoGenerateColumns="False" KeyFieldName="I_YM" Theme="Aqua1" Width="100%">
                                                        <Columns>
                                                            <dx:GridViewDataTextColumn FieldName="S_YONGHUH" Caption="用户号" Width="20%">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="S_YONGHUM" Caption="用户名" Width="35%">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="I_YM" Caption="水量年月" Width="15%">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="N_SHOUFEIJE" Caption="收费金额" Width="20%" PropertiesTextEdit-DisplayFormatString="0.00">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="I_FEIYONGBH" Caption="费用编号" Width="10%" Visible="true">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Width="35px">
                                                                <DataItemTemplate>
                                                                    <asp:LinkButton ID="lnbDel" runat="server" CausesValidation="false" Text="删除" CommandArgument='<%#Eval("KEYVALUE")%>' OnCommand="lnbDel_Command"></asp:LinkButton>
                                                                </DataItemTemplate>
                                                            </dx:GridViewDataTextColumn>
                                                        </Columns>
                                                        <Settings VerticalScrollableHeight="245" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" />
                                                    </dx:ASPxGridView>
                                                </fieldset>
                                            </div>
                                            <div style="width: 38%; float: left;">
                                                <fieldset style="border: 1px solid  cornflowerblue; width: 98%">
                                                    <legend style="font-weight: bold">欠费情况</legend>
                                                    <dx:ASPxGridView ID="gvQianFeiQK" runat="server" AutoGenerateColumns="False" KeyFieldName="I_YM" Theme="Aqua1" Width="100%" EnableCallBacks="false" OnFocusedRowChanged="gvQianFeiQK_FocusedRowChanged">
                                                        <Columns>
                                                            <dx:GridViewDataTextColumn Caption="" Width="30px">
                                                                <DataItemTemplate>
                                                                    <dx:ASPxCheckBox ID="cid" runat="server"></dx:ASPxCheckBox>                                                                    
                                                                </DataItemTemplate>
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="S_YONGHUH" Caption="用户号" Width="18%">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="I_YM" Caption="水量年月" Width="18%" CellStyle-HorizontalAlign="Center">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="N_QIANFEIJE" Caption="欠费金额" Width="21%" PropertiesTextEdit-DisplayFormatString="0.00">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="N_YINGSHOUJE" Caption="应收金额" Width="22%" PropertiesTextEdit-DisplayFormatString="0.00">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="N_SHISHOUJE" Caption="已收金额" Width="21%" PropertiesTextEdit-DisplayFormatString="0.00">
                                                            </dx:GridViewDataTextColumn>
                                                        </Columns>
                                                        <Settings VerticalScrollableHeight="245" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" />
                                                        <SettingsBehavior ProcessFocusedRowChangedOnServer="true" />
                                                    </dx:ASPxGridView>
                                                </fieldset>
                                            </div>
                                        </div>

                                        <div>
                                            <table>
                                                <tr>
                                                    <td colspan="2"></td>
                                                </tr>
                                                <tr>
                                                    <td>&nbsp;&nbsp;收费日期：
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="tab1txtSHOUFEIRQ" runat="server" Width="70px" Enabled="false"></dx:ASPxTextBox>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxLabel ID="lblShouFeiTip" runat="server" Text="" Visible="false"></dx:ASPxLabel>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>&nbsp;&nbsp;收费类型：
                                                    </td>
                                                    <td colspan="2">
                                                        <dx:ASPxComboBox ID="tab1cmbSHOUFEILX" ClientInstanceName="tab1cmbSHOUFEILX" runat="server" Width="70px" ValueType="System.String">
                                                            <Items>
                                                                <dx:ListEditItem  Text="现金" Value="1"/>
                                                                <dx:ListEditItem  Text="支票" Value="3"/>
                                                            </Items>
                                                        </dx:ASPxComboBox>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                        <dx:TabPage Text="收错冲账">
                            <ContentCollection>
                                <dx:ContentControl>
                                    <div style="padding-left: 10px;">
                                        <table>
                                            <tr>
                                                <td>当前帐务年月：</td>
                                                <td>
                                                    <dx:ASPxTextBox ID="tab2txtZWYM" ClientInstanceName="tab2txtZWYM" runat="server" Width="100px"></dx:ASPxTextBox>
                                                </td>
                                                <td>收费日期：
                                                </td>
                                                <td>
                                                    <dx:ASPxDateEdit ID="tab2txtSHOUFEIRQ" runat="server" Width="120px" OnValueChanged="tab2txtSHOUFEIRQ_ValueChanged" AutoPostBack="true"></dx:ASPxDateEdit>
                                                </td>
                                                <td></td>
                                                <td>用户号：</td>
                                                <td>
                                                    <dx:ASPxTextBox ID="tab2txtYONGHUH" runat="server" Width="100px"></dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    <dx:ASPxButton ID="tab2btnGOTO" runat="server" Text="定位" UseSubmitBehavior="false" OnClick="tab2btnGOTO_Click"></dx:ASPxButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div>
                                        <fieldset style="border: 1px solid  cornflowerblue">
                                            <legend style="font-weight: bold">收费记录</legend>
                                            <dx:ASPxGridView ID="gvShouFeiJL" runat="server" AutoGenerateColumns="False" KeyFieldName="NO" Theme="Aqua1" Width="100%">
                                                <Columns>
                                                    <dx:GridViewDataTextColumn FieldName="D_SHOUFEIRQ" Caption="收费日期" Width="10%" PropertiesTextEdit-DisplayFormatString="yyyy-MM-dd">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_YONGHUH" Caption="用户号" Width="11%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_YONGHUM" Caption="用户名" Width="39%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="I_YM" Caption="水量年月" Width="8%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="N_JINE" Caption="收费金额" Width="12%" PropertiesTextEdit-DisplayFormatString="0.00">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="S_SHOUFEIFS" Caption="收费方式" Width="12%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="I_ZWYM" Caption="帐务年月" Width="8%">
                                                    </dx:GridViewDataTextColumn>
                                                       <dx:GridViewDataTextColumn FieldName="I_SHOUFEIBH" Caption="收费编号" Width="8%">
                                                    </dx:GridViewDataTextColumn>
                                                       <dx:GridViewDataTextColumn FieldName="I_FEIYONGBH" Caption="费用编号" Width="8%">
                                                    </dx:GridViewDataTextColumn>
                                                </Columns>
                                                <Settings VerticalScrollableHeight="130" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" />
                                            </dx:ASPxGridView>
                                        </fieldset>
                                    </div>
                                    <div>
                                        <fieldset style="border: 1px solid  cornflowerblue">
                                            <legend style="font-weight: bold">汇总</legend>
                                            <dx:ASPxGridView ID="gvShouFeiJLHZ" runat="server" AutoGenerateColumns="False" KeyFieldName="S_GUANLIKM" Theme="Aqua1" Width="100%">
                                                <Columns>
                                                    <dx:GridViewDataTextColumn FieldName="S_GUANLIKM" Caption="管理块" Width="15%">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="NO" Caption="笔数" Width="15%" CellStyle-HorizontalAlign="Right">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn FieldName="N_SHISHOUJE" Caption="总金额" Width="15%" CellStyle-HorizontalAlign="Right">
                                                    </dx:GridViewDataTextColumn>
                                                </Columns>
                                                <Settings VerticalScrollableHeight="120" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" />
                                            </dx:ASPxGridView>
                                        </fieldset>
                                    </div>
                                    <fieldset style="border: 0px solid red">
                                        <div style="text-align: right;">
                                            <dx:ASPxButton ID="tab2btnSHOUFEICZ" runat="server" Text="收错冲帐" ClientSideEvents-Click="function(s,e){e.processOnServer=btnSHOUFEICZClick();}" UseSubmitBehavior="false"></dx:ASPxButton>
                                        </div>
                                    </fieldset>
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                    </TabPages>
                </dx:ASPxPageControl>
                <div>

                    <table style="width: 100%">
                        <tr>
                            <td>
                                <hr />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table align="right">
                                    <tr>
                                        <td>

                                            <dx:ASPxButton ID="btnQUERENSF" ClientInstanceName="btnQUERENSF" runat="server" Text="确认收费" UseSubmitBehavior="false" ClientSideEvents-Click="function(s,e){e.processOnServer=btnQUERENSFClick();}"></dx:ASPxButton>
                                        </td>
                                        <td>
                                            <dx:ASPxButton ID="btnOPENCK" runat="server" Text="查看" UseSubmitBehavior="false" ClientSideEvents-Click="function(s,e){openGeneranize();}"></dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>